package tool;

import java.util.HashSet;
import java.util.List;


public class numsCheck {
    public static boolean check(int[] arr1, int[] arr2) {
        if (arr1.length != arr2.length) {
            return false;
        }
        for (int i = 0; i < arr1.length; i++) {
            if (arr1[i] != arr2[i]) {
                System.out.println("nums" + i + "位置不同，他们是：" + arr1[i] + "和" + arr2[i]);
                return false;
            }
        }
        return true;
    }

    public static boolean checkList(List<Integer> arr1, List<Integer> arr2) {
        if (arr1 == null || arr2 == null || arr1.size() != arr2.size()) {
            return false;
        }
        for (int i = 0; i < arr1.size(); i++) {
            if (!arr1.get(i).equals(arr2.get(i))) {
                System.out.println("nums" + i + "位置不同，他们是：" + arr1.get(i) + "和" + arr2.get(i));
                return false;
            }
        }
        return true;
    }

    public static boolean checkListRand(List<Integer> arr1, List<Integer> arr2) {
        if (arr1 == null || arr2 == null || arr1.size() != arr2.size()) {
            assert arr1 != null;
            System.out.println("arr1 size is:\t"+arr1.size());
            System.out.println("arr1 is:\t"+arr1);
            assert arr2 != null;
            System.out.println("arr2 size is:\t"+arr2.size());
            System.out.println("arr2 is:\t"+arr2);
            return false;
        }
        HashSet<Integer> set1 = new HashSet<>(arr1);
        for (Integer num : arr2) {
            if (!set1.contains(num)){
                return false;
            }
        }
        return true;
    }
}
